UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sJIIvGCTJMiZD68WtSCIDN9wFt7IrD8UiULpIWta6Xs='
WHERE
key_id = '322a1e3dd99ce8f4753126548f6106dc0803d9c04674f96f85c96baa2f69d22e'
AND (
token = 'sJIIvGCTJMiZD68WtSCIDN9wFt7IrD8UiULpIWta6Xs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)