UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x+EmWkgxY/6i0V77y5KlBaGAbn2pS8jnuhbODRnbUTU='
WHERE
key_id = 'cd30316fe964c302d0b7e25b3340af68c948c5203bf74e641e5a7ae181185f89'
AND (
token = 'x+EmWkgxY/6i0V77y5KlBaGAbn2pS8jnuhbODRnbUTU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)