UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WV+JclTQhchmKF267UHamFSe2WdvjEpqyhd1Kb5rgSs=' 
WHERE 
  key_id = 'b6f91e3f6c3e6c05098297a55376de9048500b4562d44697acb956983f707357' 
  AND (
    token = 'WV+JclTQhchmKF267UHamFSe2WdvjEpqyhd1Kb5rgSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025