UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IcCvlzFZjsmjSu0ZWH/mN0ZA14tPZF7Us6nY7E7EO+U=' 
WHERE 
  key_id = 'cee19bedc9e8971c95e2d146b4d700939859bdaf376aa1289345fb02c02ced7e' 
  AND (
    token = 'IcCvlzFZjsmjSu0ZWH/mN0ZA14tPZF7Us6nY7E7EO+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038