UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dD4nAM0PzX5ozxYRLG4A8briADXA6yNlDroooFumJGE=' 
WHERE 
  key_id = 'f5ccdeaa0d8a21bd37a2255088fbe8b338385173c8ff9489385d4850945c1e8d' 
  AND (
    token = 'dD4nAM0PzX5ozxYRLG4A8briADXA6yNlDroooFumJGE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039