UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j4kvjN8PRORngqz+W8Yi7ngPbwR5vV6iqQvCgO6YyZM='
WHERE
key_id = '22dcc58369f17270c8a256165bdb29b558e8cec4fcc6c6e1db0ecc2ae9ffd5d2'
AND (
token = 'j4kvjN8PRORngqz+W8Yi7ngPbwR5vV6iqQvCgO6YyZM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)