UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y+8SYuG9s3Gx1RghCVVAbDM1IAV1/D2Yr8P7A8mkPBg=' 
WHERE 
  key_id = 'a6e33356a1595df9fa4bf695213640680ad66714399ebf1c15b0dc4ef7359669' 
  AND (
    token = 'Y+8SYuG9s3Gx1RghCVVAbDM1IAV1/D2Yr8P7A8mkPBg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025