UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r7+AkFIHdnpjoY9GCqXMYUI9of0xahpJBKkGu9uRTX8='
WHERE
key_id = '0e7cc197a688c559aab1d7b3b4cfcf90ee09772c9a0aec0ae2e1a01fad63b57c'
AND (
token = 'r7+AkFIHdnpjoY9GCqXMYUI9of0xahpJBKkGu9uRTX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)