UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VoXZlqkvT8n1PSAP9X9V0E+9waPv2HFN8gva4AIvMlc=' 
WHERE 
  key_id = '39b88dc4f995af4b42d2d62050e0f779cc4ed8cedb0bfd28e59501bf994c8061' 
  AND (
    token = 'VoXZlqkvT8n1PSAP9X9V0E+9waPv2HFN8gva4AIvMlc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046