UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lfs88aoX3YTF7D7lCAyrZF+BxjF1n3oTcMOJXeTB9mw='
WHERE
key_id = '973ea2781ced70bfbd0507c46c94c22d6c4d89bfd84b59d4fa9f61c4ec2357a4'
AND (
token = 'lfs88aoX3YTF7D7lCAyrZF+BxjF1n3oTcMOJXeTB9mw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)