UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iddSj8esEXsJgKYt9nk4nYU+yIyVqAbOj53Rea8GUn0='
WHERE
key_id = 'ad0341c8762bda49990ef730e35847e57fdb641ded142f673b1be1c70d1a9dd8'
AND (
token = 'iddSj8esEXsJgKYt9nk4nYU+yIyVqAbOj53Rea8GUn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)