UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w+9/SUAwUWnuztd71WICodDpYvVnMFMDZ8hmbQzIuGI='
WHERE
key_id = '8ee5807bea2d7ad741302084885e61a6d285e4b5d7695101b1dd86dd68c8a74e'
AND (
token = 'w+9/SUAwUWnuztd71WICodDpYvVnMFMDZ8hmbQzIuGI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)