UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0TdNx3qDKuPK/mWuNKkSjM48ItMx+6lHjDNhgd5qgvs='
WHERE
key_id = '0a58bc13505687196c0cf2a81f0cba7ed850c0ca589562d2737df3832539c6f2'
AND (
token = '0TdNx3qDKuPK/mWuNKkSjM48ItMx+6lHjDNhgd5qgvs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)