UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kk8pvmRX4b5vmSqd/eKAx6LVPJTyi5CmLkPyMIgfs4U='
WHERE
key_id = 'afa1c6f470d12ff7db035137531bf93d420ff8b66743122fc104e3622ba4ab53'
AND (
token = 'kk8pvmRX4b5vmSqd/eKAx6LVPJTyi5CmLkPyMIgfs4U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)