UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'loP6v+IGE/MfLyqKH/L9JI2rb24n/8F6+K9fsTk0eu4='
WHERE
key_id = 'a896c5cc732abfe215a79a1e36f7ef501254c7f25615ef2563ab781fec6979e1'
AND (
token = 'loP6v+IGE/MfLyqKH/L9JI2rb24n/8F6+K9fsTk0eu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)