UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KUoXWDVuOiEEPaHnbFEFNpyuP0qUWr/Gx6YsguwXLzI='
WHERE
key_id = 'd3ba59e2cb0587385338322b396b8ff59a44cf1234ab9c1a2e5aacef82008d3b'
AND (
token = 'KUoXWDVuOiEEPaHnbFEFNpyuP0qUWr/Gx6YsguwXLzI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)