UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zbuLo1tAZOos+16TIatairnILWh0kiHWrgcKQAHgz9Q='
WHERE
key_id = '87d4f0961888a8a81e623281ff3d5c01bdc74f0667b05821d200a9b2fcd498c0'
AND (
token = 'zbuLo1tAZOos+16TIatairnILWh0kiHWrgcKQAHgz9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)