UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3cb+tVhnM5gIviuNw1oK+ym2RW2GpBDojj5VWb5ZXr0='
WHERE
key_id = 'c2fd6d0a652cfad6581575eff1a83e020196a790982dfe43224dda325aa18b1e'
AND (
token = '3cb+tVhnM5gIviuNw1oK+ym2RW2GpBDojj5VWb5ZXr0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)