UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YMCTKAEkoMQw+ALG0855ogwlCMzi78FNbtO2ZuwPBb4='
WHERE
key_id = 'e895490112176f392f9bfed89e4e1ce58ac06ab5dbb350c33bd89a67ff6c1853'
AND (
token = 'YMCTKAEkoMQw+ALG0855ogwlCMzi78FNbtO2ZuwPBb4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)