UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eD6qp0qk2B/S82IoPrnahijmYeJTcU+69t9U44Dvzek=' 
WHERE 
  key_id = 'ec4515b9a75e43ea64ee3501ca62902b8c7a389a6ebce4264e80c1d440e3d985' 
  AND (
    token = 'eD6qp0qk2B/S82IoPrnahijmYeJTcU+69t9U44Dvzek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047