UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6hInUgvZLWufx0R5HA3LmqShzPAFt8GhLOrEibRGPF4=' 
WHERE 
  key_id = '199f62984ccdb877a1c8a17b309e0e5dcf85f781b6865ac9276ed6b5f0cc7898' 
  AND (
    token = '6hInUgvZLWufx0R5HA3LmqShzPAFt8GhLOrEibRGPF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026