UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iLto9spPcQaXLv3lpiwpjsnxGUiqrmgauS3cpmSBCNo=' 
WHERE 
  key_id = '0568f27f6d568f53e642962da99701b1a8a8f16043a4a5b90daf211a74214f32' 
  AND (
    token = 'iLto9spPcQaXLv3lpiwpjsnxGUiqrmgauS3cpmSBCNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021