UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wwpJdKHV3siUz37xAA31JJAH/qIF9vLes726AaPJrrY=' 
WHERE 
  key_id = '4f84b104788616c3f46ff5da0ea8f48f2df76785e34107c5fec704bfda19e6a6' 
  AND (
    token = 'wwpJdKHV3siUz37xAA31JJAH/qIF9vLes726AaPJrrY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036