UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vAtaNEZWPaHh2XvRbuwDehTYcJDdcih5uWeRCBmB4Ow=' 
WHERE 
  key_id = '80a201335a757d2cb498f397c7967eef9586073191eada7cc19ad836d85e5c45' 
  AND (
    token = 'vAtaNEZWPaHh2XvRbuwDehTYcJDdcih5uWeRCBmB4Ow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031