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

Query time 0.00023