UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8xW1HMPXHPPNV3f3EQitsIctwICTlEWCLHWHRQiAMf0=' 
WHERE 
  key_id = '9729177ecc55dc201aa4ec36759c636b58ded86f59b2fb1944f926680ed95770' 
  AND (
    token = '8xW1HMPXHPPNV3f3EQitsIctwICTlEWCLHWHRQiAMf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043