UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XxGlzG2LDINsnU0owievPvFYTU2ncsGOt+yEJeOG3po=' 
WHERE 
  key_id = '285ff01212e3b1a5d824971ca36c05ad2a8eb3d2237fb2660f146275b528e763' 
  AND (
    token = 'XxGlzG2LDINsnU0owievPvFYTU2ncsGOt+yEJeOG3po=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025