UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p9Mam45lGIwy2+MA9/HATWjOndBMv/QSS5ES54a431M=' 
WHERE 
  key_id = '6e94ec35902971efe8762c15aaa1dbcc152cdd0e8204827c3506921596271074' 
  AND (
    token = 'p9Mam45lGIwy2+MA9/HATWjOndBMv/QSS5ES54a431M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052