UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Adv2tmTYB+SK8Atigj3sln6xkkJkpfuVu49ALFpMu48='
WHERE
key_id = '5bda163af82058a6917e0c9fa98ddc74e5ebd5790e083f31896f5186af776bc1'
AND (
token = 'Adv2tmTYB+SK8Atigj3sln6xkkJkpfuVu49ALFpMu48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)