UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'myBnjeDFA0HUAYvNs0UpnfGF9r13vvRQXDIRj2Vko1Y=' 
WHERE 
  key_id = '9941f1ec02999eaf780f5718da7a89b8085b3631c550eec986bd806d394dda88' 
  AND (
    token = 'myBnjeDFA0HUAYvNs0UpnfGF9r13vvRQXDIRj2Vko1Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016