UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NW7yoJ3SsZxezhTaXGSXYNi4b7tZMXd1XqKyoyDeyNo='
WHERE
key_id = '9c9cf4a75d839639c7bb1f4fe44736a1938d7ffcea975719c9750204eeccbdda'
AND (
token = 'NW7yoJ3SsZxezhTaXGSXYNi4b7tZMXd1XqKyoyDeyNo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)