UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JejdXIRr8sJYHaTEY4mmnfhZrzeFlMzkwKJPf2XvAas='
WHERE
key_id = 'dd08091c02b085d39315450fcc041b19ca373cbfb9ebb73f7c2f40ee21618314'
AND (
token = 'JejdXIRr8sJYHaTEY4mmnfhZrzeFlMzkwKJPf2XvAas='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)