UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9at4mMU/RsJriT5ajfCHcfE7Iyr39UnH2380Jd78zWU='
WHERE
key_id = 'a9f74169c9cab911c4e28f18df8b3a76d39f3e071b90ec479202bb8d4674b5b8'
AND (
token = '9at4mMU/RsJriT5ajfCHcfE7Iyr39UnH2380Jd78zWU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)