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