UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Om7wQsVf4cJfgKyiJBddMEceiljRdk9TmNWP4A+EebU='
WHERE
key_id = '2f9232a3247b5f165f47fa4255798810847b9efe4626c3e6aaa7bd8a3817444f'
AND (
token = 'Om7wQsVf4cJfgKyiJBddMEceiljRdk9TmNWP4A+EebU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)