UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R9y2HJ7gRLJtCqYEmTQoY68BGswaV4C5EA4UXZOoC/A=' 
WHERE 
  key_id = '09f1ebad4a6a823c12b235da9d571b68856ccfb8d572445eaaffea9331c6d1dd' 
  AND (
    token = 'R9y2HJ7gRLJtCqYEmTQoY68BGswaV4C5EA4UXZOoC/A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035