UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k+66Aw/1e6oF1IWt6ljdox78Ro52Patde7mlrhPZ3J4='
WHERE
key_id = '2ea31ff8026e895b7a178a6c5b4cea9a1d8620f2040c6798fade7fd5aae63af4'
AND (
token = 'k+66Aw/1e6oF1IWt6ljdox78Ro52Patde7mlrhPZ3J4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)